<template>
	<view>
		<view class="p-3">
			<view class="bt-block">
				<bg-cell2 :border="false" label="项目名称" :value="obj.projectName"></bg-cell2>
			</view>
			
			<view class="bt-block mt-3">
				<bg-cell2 label="保险单" :border="false">
					<template slot="extra">
						<web-view :update-title="false" :src="pdfUrl" :fullscreen="false"></web-view>
					</template>
				</bg-cell2>
				
			</view>
		</view>
	</view>
</template>

<script>
	import { insuranceDetail } from '../../../api/apply'
	export default {
		data() {
			return {
				id:'',
				obj:{},
				pdfUrl:""
			}
		},
		onNavigationBarButtonTap() {
			uni.navigateTo({
				url:"/pages/more/insure/insure?id="+this.id
			})
		},
		created(){
			// #ifdef APP-PLUS
			var currentWebview = this.$mp.page.$getAppWebview(); //获取当前web-view
			setTimeout(function() {
			var wv = currentWebview.children()[0];
			wv.setStyle({ //设置web-view距离顶部的距离以及自己的高度，单位为px
				top: 220,
				})
			}, 1000);
			// #endif
		},
		onLoad(options){
			this.id = options.id
			this.getData()
		},
		methods: {
			getData(){
				insuranceDetail(this.id).then(res=>{
					this.obj = res.data
					this.pdfUrl = '/hybrid/html/web/viewer.html?file='+encodeURIComponent(res.data.insurancePolicy)
				})
			}
		}
	}
</script>

<style>

</style>
